<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page contentType="text/html;charset=UTF-8"
	import="com.srit.forecast.constant.Constant"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="srit-tag" uri="/srit-constant-tag"%>
<srit-tag:Constant var="PAGE_TYPE_FORM" />
<srit-tag:Constant var="PAGE_TYPE_LIST" />
<srit-tag:Constant var="PAGE_TYPE_ALL" />
<html>
<head>
<title></title>
<link href="<c:url value="/resources/css/style.css" />" rel="stylesheet"
	type="text/css">
<link href="<c:url value="/resources/css/list_css.css" />"
	rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/css/autocomplete.css" />"
	rel="stylesheet" type="text/css">
<script src="<c:url value="/resources/js/jquery-1.8.0.min.js" />"></script>
<script src="<c:url value="/resources/js/jquery.autocomplete.js" />"></script>

<script>
	$(document).ready(function() {
		console.log("abc");
		$("#autocomplete6").autocomplete({
			source : [ 'a', 'b', 'c', 'd', 'e' ],
			fillin : true
		});
	})
</script>

</head>
<!--
<%out.print(request.getAttribute("pageTypeKey"));%>

${fn:containsIgnoreCase("ABCallIST", PAGE_TYPE_LIST)}
  -->
<!-- 搜索 -->
<c:if test="${pageType==PAGE_TYPE_ALL}">
	<div id="SearchDiv">
		<form:form commandName="searchForm" action="/searchWeatherCode"
			method="post">
			<table class="sritTable" align='center' width="98%"
				style="margin-bottom: 5px">
				<tr>
					<th colspan="6">气象代码查询</th>
				</tr>
				<tr>
					<td class="td_tl">名称</td>
					<td><form:input path="name" /></td>
					<td class="td_tl">编码</td>
					<td><form:input path="code" /></td>
					<td class="td_tl">类型</td>
					<td><form:input path="type" />
					</td>
				</tr>
				<tr>
					<td colspan="6" class="td_tl"><input type="submit" value="搜索" /></td>
				</tr>
			</table>
		</form:form>
	</div>
</c:if>


<!-- 表单页 -->
<c:if test="${pageType==PAGE_TYPE_FORM||pageType==PAGE_TYPE_ALL}">
	<div id="createDiv">
		<form:form commandName="weatherCode"
			action="/weatherCode-saveOrUpdate" method="post"
			enctype="multipart/form-data">
			<form:hidden path="id" />
			<table class="sritTable" align='center' id="table" width="98%">
				<tr>
					<th colspan="4">气象代码新增</th>
				</tr>
				<tr>
					<td class="td_tl">名称</td>
					<td><form:input path="name" /></td>
					<td class="td_tl">编码</td>
					<td><form:input path="code" /></td>
				</tr>
				<tr>
					<td class="td_tl">类别</td>
					<td><form:input path="type" /> 
						 <input id="autocomplete6">
					<!-- <select><option>111</option></select> -->
						<!-- <div style="width:200px;height:200px;background-color:red;position:relative ;top:-10px"></div> -->
					</td>
					<td class="td_tl">启用</td>
					<td><label><form:radiobutton path="enabled" value="Y" />是</label>
						<label><form:radiobutton path="enabled" value="N" />否</label></td>
				</tr>
				<tr>
					<td class="td_tl">图片</td>
					<td><input type="file" name="uploadItem" /> <form:hidden
							path="image" /> <a
						href="<c:url value="/upload/${weatherCode.image}"></c:url>">图片
					</a></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td colspan="4" class="td_tl"><c:if
							test="${weatherCode.id==null}">
							<input type="submit" value="保存" />
						</c:if> <c:if test="${weatherCode.id!=null }">
							<input type="submit" value="修改" />
						</c:if> <input type="reset" /></td>
				</tr>
			</table>
		</form:form>
	</div>
</c:if>

<!-- 列表页 -->
<c:if test="${pageType==PAGE_TYPE_LIST||pageType==PAGE_TYPE_ALL}">
	<div id="pageDiv">
		<div>
			<a href="<c:url  value="/weatherCode-form"></c:url>">创建</a>
		</div>
		<table class="sritTable" align='center' id="table" width="98%"
			style="margin-top: 5px">
			<tr>
				<th><input type="checkbox" /></th>
				<th>TYPE</th>
				<th>NAME</th>
				<th>CODE</th>
				<th>ENABLED</th>
			</tr>
			<c:forEach var="wc" items="${page.list}">
				<tr onMouseOver="javascript:this.style.backgroundColor='#AABBFF';"
					onMouseOut="javascript:this.style.backgroundColor='#FFFFFF';"
					ondblclick="javascript:window.location='<c:url  value="/weatherCode-edit">
					<c:param name="id" value="${wc.id }"/>
					</c:url>'">
					<td><input type="checkbox" value="${wc.id }" /></td>
					<td>${wc.type }</td>
					<td>${wc.name }</td>
					<td>${wc.code }</td>
					<td>${wc.enabled }</td>
				</tr>
			</c:forEach>
		</table>

		<table class="sritTable" align='center' id="table" width="98%"
			style="margin-top: 0px">
			<tr>
				<td class="td_tl">${page.count},${page.pageNum}</td>
			</tr>
		</table>
	</div>
</c:if>
</html>




